home *** CD-ROM | disk | FTP | other *** search
/ Windows 3-Pak - Disc 3 / Infomagic - Windows 3-Pak (Disc 3 of 3).iso / Telnet-Clients / ericnet.exe / TNPRINT.SH < prev   
Text File  |  1999-01-20  |  3KB  |  84 lines

  1. :
  2. # Sample Shell Script -
  3. #          how to address the WINDOWS printer
  4. #          via "Eric's Telnet98" from a UNIX host
  5. #
  6. #          this script can be used as a filter and as a command
  7. #
  8. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9. # Notice:  the printer can be managed more precisely 
  10. #          with the following additional escapes:
  11. #
  12. #
  13. # EOL          ESC[5;2 i       set printposition to pos 0 in the current line
  14. # LFBACK       ESC[5;3 i       linefeed one line back
  15. # CPI          ESC[5;6;n i     characters per inch
  16. # POSITION     ESC[5;12;n i    set printposition in the current line
  17. #                              n= column
  18. # BOLD         ESC[5;14;n i    n=0 => bold mode OFF
  19. #                              n=1 => bold mode ON
  20. # RESET        ESC[5;17 i      reset all attributes to default
  21. # UNDERLINE    ESC[5;18;n i    n=0 => underline mode OFF
  22. #                              n=1 => underline mode ON
  23. # STRIKE       ESC[5;19;n i    n=0 => strikeout mode OFF
  24. #                              n=1 => strikeout mode ON
  25. # SUBSCRIPT    ESC[5;20;n i    n=0 => subscript mode OFF
  26. #                              n=1 => subscript mode ON
  27. # SUPERSCRIPT  ESC[5;21;n i    n=0 => superscript mode OFF
  28. #                              n=1 => superscript mode ON
  29. # DOUBLEHEIGHT ESC[5;22;n i    n=0 => double height mode OFF
  30. #                              n=1 => double height mode ON
  31. # DOUBLEWIDTH  ESC[5;23;n i    n=0 => double width mode OFF
  32. #                              n=1 => double width mode ON
  33. # PAGELENGTH   ESC[5;24;n i    n= lines per page
  34. # LPI          ESC[5;26;n i    n= lines per inch
  35. # ITALIC       ESC[5;27;n i    n=0 => italic mode OFF
  36. #                              n=1 => italic mode ON
  37. #########################################################################
  38.  
  39. OPEN_PRINTER="\033[5i"
  40. CLOSE_PRINTER="\033[4i"
  41. export OPEN_PRINTER CLOSE_PRINTER
  42.  
  43.  
  44.  
  45. filter()
  46. {
  47.         /bin/echo "${OPEN_PRINTER}\c"
  48.     cat
  49.         /bin/echo "${CLOSE_PRINTER}\c"
  50. }
  51.  
  52.  
  53.  
  54. PrintFile()
  55. {
  56.     MY_NAME=$1
  57.     shift 1
  58.         for FILE in $*
  59.     do
  60.                 echo ${FILE}
  61.                 [ -r ${FILE} ] || {
  62.                         echo "${MY_NAME}: cannot open ${FILE}">&2
  63.             continue
  64.         } 
  65.                 /bin/echo "${OPEN_PRINTER}\c"
  66.                 cat ${FILE}
  67.                 /bin/echo "${CLOSE_PRINTER}\c"
  68.     done
  69.  
  70.  
  71.  
  72. #
  73. # main
  74. #------------------------------------
  75. #
  76. trap "" 1 2 3
  77. if expr $# \> 0 >/dev/null 2>&1
  78. then
  79.     PrintFile $0 $*
  80. else
  81.     filter
  82. fi
  83.